/*  This file is part of -_-.

    -_- is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    -_- is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with -_-.  If not, see <http://www.gnu.org/licenses/>.

    Copyright 2012 Oliver Katz */

#include <iostream>
#include "kernel.h"

int main(int argc, char *argv[])
{
	Kernel k = Kernel();
	k.init(&argc, &argv);
	k.rect(0, 0, k.getWidth(), k.getHeight(), 0x00, 0x00, 0x00, 0xff);
	k.line(0, 0, 100, 100, 0xff, 0xff, 0xff, 0xff);
	k.update();

	k.image(200, 10, "kitten.jpg");
	k.update();

	k.loadFont("sans", "DejaVuSans.ttf", 16);
	k.text(300, 10, 0xff, 0x00, 0x00, 0xff, "sans", "hello, world");
	k.unloadFont("sans");
	k.update();

	k.rect(0, 0, k.getWidth(), k.getHeight(), 0xff, 0xff, 0xff, 0xff);
	k.update(0, 200, 100, 300);

	while(1)
	{
		vector<Event> e = k.waitForEvents();
		for (vector<Event>::iterator i = e.begin(); i != e.end(); i++)
		{
			if (i->getType() == Event::keypress && i->getKey() == DIKS_ESCAPE)
			{
				k.halt();
				return 0;
			}
			else
			{
				cout << i->display() << "\n";
			}
		}
	}

	k.halt();
	return 0;
}

